<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Product Description</title>
    <style type="text/css">
        body {
            padding: 4%;
            margin: 0;
            height: 100%;
            min-height: 100vh;
            font-size: 14px;
        }
        #input {
            min-height: 100vh;
            cursor: default; /* 显示默认光标，表明不可编辑 */
            font-size: 14px;
        }
        #input:empty::before {
            color: #767676;
            content: attr(placeholder);
            font-size: 14px;
        }
        img {
            width: 80px;
            height: auto;
            display: inline-block;
        }
    </style>
</head>
<body>
<div id="input" placeholder=""></div>

<script type="text/javascript">
    document.addEventListener('DOMContentLoaded', () => {
        const input = document.getElementById('input');

        function insertHtml(html) {
            input.innerHTML += html;
            document.body.scrollTop = document.body.scrollHeight;
            window.location.href = 're-callback://' + encodeURIComponent(input.innerHTML);
        }

        window.insertImage = function(url) {
            const html = `<img src="${url}" /><br>`;
            insertHtml(html);
        }

        window.setHtml = function(html) {
            input.innerHTML = decodeURIComponent(html.replace(/\+/g, '%20'));
        }
    });
</script>
</body>
</html>
